package co.salehi.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

@RooJavaBean
@RooToString
@RooEntity
public class LabourCharge {

    @NotNull
    private Integer price;

    @NotNull
    private String description;

    @NotNull
    private Integer receiptPrice;
    
    @DateTimeFormat(pattern = "dd-MM-yyyy")
	private Date sellDate;
    
	public static List<LabourCharge> findAllLabourCharges() {
		return entityManager().createQuery("select o from LabourCharge o where o.sellDate is null", LabourCharge.class)
				.getResultList();
	}
	
    public static List<LabourCharge> findLabourChargeEntries(int firstResult, int maxResults) {
        return entityManager().createQuery("select o from LabourCharge o where o.sellDate is null ", LabourCharge.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
    }


}
